/*
 * Copyright 2011 The Rusted Roof, LLC.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package org.proteusframework.platformservice;


import org.proteusframework.core.api.model.IStandardPlugin;

import java.util.List;

/**
 * Specialized type of an {@link org.proteusframework.core.api.model.IPlugin} that depicts a platform service plugin. Platform service plugins expressly
 * provide application-wide services that are intrinsically integrated into the Proteus Framework itself.
 * <p/>
 * There are five intrinsic platform service abstractions:
 * <p/>
 * <ul>
 * <li>Plugin Modules (which are effectively implemented by {@link org.proteusframework.core.api.model.IPlugin}</li>
 * <li>Persistence Providers</li>
 * <li>Messaging</li>
 * <li>UI Themes</li>
 * <li>Application Configurators</li>
 * <li>Project Lifecycle Managers</li>
 * </ul>
 */
public interface IServicePlugin extends IStandardPlugin
{
    /**
     * Defines a specific set of service scopes that are explicitly <i>not supported</i> by the service plugin. By
     * default, all service scopes are supported for service plugins regardless of how the actual service plugin
     * was physically implemented. The management of scoped instances is handled entirely by the
     * {@link ExtendedProteusApplication}.
     * <p/>
     * In situations where a custom service plugin cannot support specific types of {@link ServiceScope}, it is
     * possible to explicitly declare which scopes are not supported. For example, if a custom service uses a
     * specific configuration that precludes it from being anything other than an application singleton, the
     * custom service plugin can explicitly declare that it does not support the other <code>ServiceScope</code>s.
     *
     * @return List of <i>unsupported</i> service scopes
     */
    List<ServiceScope> getRestrictedServiceScopes();

    /**
     * Lifecycle method that instructs the platform service plugin to initialize itself and fully spin up online.
     */
    void start();

    /**
     * Lifecycle method that instructs the platform service plugin to terminate and release any acquired resources.
     */
    void stop();
}
